﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TeamListFrame.ascx.cs"
    Inherits="AB.ServiceDirectory.Design.WebUserControls.Frame.TeamListFrame" %>
<script type="text/javascript">
    function Confirm_Active() {
        return confirm('Do you want to make this Team active ?');
    }
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div class="titleh">
            <h3 class="sorting_range">
                <asp:LinkButton ID="LinkButtonAll" runat="server" CssClass="hg-blue" CommandName="all"
                    OnCommand="FilterByLetters_Command" CausesValidation="false" 
                    ClientIDMode="Static">All</asp:LinkButton>
                <asp:LinkButton ID="LinkButton09" runat="server" CommandName="09" OnCommand="FilterByLetters_Command"
                    CausesValidation="False" ClientIDMode="Static">0-9</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonAE" runat="server" CommandName="ae" OnCommand="FilterByLetters_Command"
                    CausesValidation="False" ClientIDMode="Static">A B C D E</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonFJ" runat="server" CommandName="fj" OnCommand="FilterByLetters_Command"
                    CausesValidation="False" ClientIDMode="Static">F G H I J</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonKN" runat="server" CommandName="kn" OnCommand="FilterByLetters_Command"
                    CausesValidation="False" ClientIDMode="Static">K L M N</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonOR" runat="server" CommandName="or" OnCommand="FilterByLetters_Command"
                    CausesValidation="False" ClientIDMode="Static">O P Q R</asp:LinkButton><asp:LinkButton ID="LinkButtonSV"
                        runat="server" CommandName="sv" OnCommand="FilterByLetters_Command" 
                    CausesValidation="False" ClientIDMode="Static">S T U V</asp:LinkButton>
                <asp:LinkButton
                            ID="LinkButtonWZ" runat="server" CommandName="wz" OnCommand="FilterByLetters_Command"
                            CausesValidation="False" ClientIDMode="Static"> W X Y Z</asp:LinkButton><span class="right">
                                <asp:LinkButton ID="LinkCreate" runat="server" CssClass="hg-blue" CausesValidation="False"
                                    OnCommand="LinkCreate_Command">Create</asp:LinkButton>
                                <asp:CheckBox ID="CheckBoxInactive" runat="server" Text="Include In-active" AutoPostBack="True"
                                    OnCheckedChanged="CheckBoxInactiveCheckedChanged" CausesValidation="false" />
                            </span>
            </h3>
        </div>
        <div class="clear">
        </div>
        <asp:GridView ID="GridViewTeam" CssClass="tablesorter" runat="server" AutoGenerateColumns="False"
            DataSourceID="ObjectDataSourceTeam" AllowPaging="True" PageSize="15" AllowSorting="True">
            <Columns>
                <asp:TemplateField HeaderText="Team Name" SortExpression="TeamName">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButtonTeamName" CausesValidation="false" runat="server" CommandName='<%# Eval("TeamId") %>'
                            CommandArgument='<%#Eval("IsActive") %>' OnClientClick='<%# !(bool)Eval("IsActive") ? "return Confirm_Active();" : string.Empty %>'
                            OnCommand="LinkButtonTeamName_Command"><%# Eval("TeamName") %></asp:LinkButton>
                    </ItemTemplate>
                    <HeaderStyle CssClass="header" Width="150px"/>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Address Line 1" SortExpression="Address">
                    <ItemTemplate>
                        <%#Eval("Address.AddressLine") %>
                    </ItemTemplate>
                    <HeaderStyle CssClass="header" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Postcode" SortExpression="Postcode">
                    <ItemTemplate>
                        <%#Eval("Address.PostCode") %>
                    </ItemTemplate>
                    <HeaderStyle CssClass="header" Width="160px"/>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Contact" SortExpression="Contact">
                    <ItemTemplate>
                        <%#string.Format("{0} {1}", Eval("Contact.FirstName"), Eval("Contact.Surname"))%></ItemTemplate>
                    <HeaderStyle CssClass="header" Width="150px"/>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Is Active?" SortExpression="Isactive">
                    <ItemTemplate>
                        <asp:Label ID="Label5" runat="server" Text='<%#(bool) Eval("IsActive") ? "Yes" : "No"%>'></asp:Label></ItemTemplate>
                    <HeaderStyle CssClass="header" Width="90px"/>
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                <blockquote>
                    There are no items to show.</blockquote>
            </EmptyDataTemplate>
            <PagerStyle CssClass="pagination_table"></PagerStyle>
        </asp:GridView>
        <asp:ObjectDataSource ID="ObjectDataSourceTeam" runat="server" SelectMethod="GetTeam"
            TypeName="AB.ServiceDirectory.BO.TeamBO" OnSelecting="ObjectDataSourceTeam_Selecting"
            EnablePaging="true" SelectCountMethod="GetTeamCount" StartRowIndexParameterName="startRowIndex"
            MaximumRowsParameterName="maxRows" SortParameterName="sortType">
            <SelectParameters>
                <asp:Parameter Name="filter" Type="Object" ConvertEmptyStringToNull="false" />
            </SelectParameters>
        </asp:ObjectDataSource>
    </ContentTemplate>
</asp:UpdatePanel>
